package com.bw.liuyushan.liuyushan20210929.MVP.Activity;

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Intent;
import android.widget.ImageView;

import com.bw.liuyushan.liuyushan20210929.MVP.Contrack.IContrackTest;
import com.bw.liuyushan.liuyushan20210929.MVP.Model.BaseModelTest;
import com.bw.liuyushan.liuyushan20210929.MVP.Presenter.BasePresenterTest;
import com.bw.liuyushan.liuyushan20210929.R;
import com.bw.liuyushan.mvp_lib.View.BaseActivity;

public class WelcomeActivity extends BaseActivity<BasePresenterTest> implements IContrackTest.C_ViewTest {


    private android.widget.ImageView imgWel;

    @Override
    public int bindLayout() {
        return R.layout.activity_welcome;
    }

    @Override
    public void initView() {
        //链接 防内存泄露
        mPresenter=new BasePresenterTest(new BaseModelTest(),this);

        imgWel = (ImageView) findViewById(R.id.img_wel);
    }

    @Override
    public void initDate() {
        ObjectAnimator alpha = ObjectAnimator.ofFloat(imgWel, "alpha", 2, 0);
        alpha.setDuration(5000);//5秒时间
        alpha.start();
        alpha.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {

            }

            @Override
            public void onAnimationEnd(Animator animation) {//5秒后跳转
                Intent intent = new Intent(WelcomeActivity.this,UesrMainActivity.class);
                startActivity(intent);
                finish();//完成
            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        });

    }
}
